package org.smartagents.test.enviro;

import org.smartagents.body.*;
import org.smartagents.enviro.Environment;
import org.smartagents.enviro.EnvironmentConstants;
import org.smartagents.global.Identifiable;
import org.smartagents.util.Logger;

public class Case1 {



    public static void main(String[] args) {
        Environment enviro = new Environment();

        Neurone cortex = new Neurone();

        Neurone n1 = BrainBuilder.buildNeurone("E.*");
        Neurone n2 = BrainBuilder.buildNeurone("E.*_M.*");

        cortex.addLink(n1);
        cortex.addLink(n2);

        n2.addLink(cortex);

        String cortexCode = cortex.getCode();

        Substance sub1 = SubstanceFactory.getSubstance("E1", 1, null, "E,1,3");
        Substance sub2 = SubstanceFactory.getSubstance("M1", -1, "M.*", "M");
        Substance sub3 = SubstanceFactory.getSubstance("R1", 8, null, "R");

        System.out.println(sub1.toString());
        System.out.println(sub2.toString());
        System.out.println(sub3.toString());


        //String organism1 = "muscle&2&&M%eye&5&&E-1-3="+cortexCode;
        String organism1 = sub1.toString()+ EnvironmentConstants.SUBSTANCE_SEPARATOR +
                           sub2.toString()+EnvironmentConstants.SUBSTANCE_SEPARATOR +
                           sub3.toString()+EnvironmentConstants.BODY_BRAIN_SEPARATOR +
                        cortexCode;
        
        System.out.println(organism1);
        Body body = BodyFactory.buildBody(organism1,100,100);

        

        Identifiable substance = SubstanceFactory.getSubstance("G1&2&&G",102,100);

        System.out.println(body.getCortex().getChids(0, null));

        enviro.addBody(body);
        enviro.addBody(substance);

        Logger.logExtreme("Starting ...");

        new Thread(enviro).start();
        System.out.println("Ended ...");

    }
}